package com.xyz.service;

import com.xyz.entity.pojo.PartApplyDetail;
import com.xyz.entity.pojo.PartInfo;
import com.xyz.util.dto.DataResult;
import com.xyz.util.dto.LoginInfo;

import java.util.List;
import java.util.Map;

public interface PartService {

    // 备件仓库库位二级联动
    DataResult selectPartWarehouseLink(LoginInfo li) throws Exception;

    // 备件仓库库位二级联动（库位未被占用）
    DataResult selectPartWarehouseLinkUnused(LoginInfo li, long partId) throws Exception;

    // 备件所属仓库库位二级联动
    DataResult selectPartStockLink(LoginInfo li, long partId) throws Exception;

    // 备件
    DataResult selectPart(LoginInfo li, int pageNum, int pageSize, String tech, String codeOrName, String nature,
                          String minPrice, String maxPrice, String minStock, String maxStock,String teamGroup) throws Exception;

    DataResult selectPartInfo(LoginInfo li, long id) throws Exception;

    DataResult insertPartInfo(LoginInfo li, String code, String name, String specs,
                              String brand, String unit, String price, int warnStock, int maxStock, int nature, int tech,String teamGroup,String specification) throws Exception;

    DataResult updatePartInfo(LoginInfo li, long id, String code, String name,
                              String specs, String brand, String unit, String price,
                              int stock, int warnStock, int maxStock, int nature, int tech,String teamGroup,String specification) throws Exception;

    DataResult deletePartInfo(LoginInfo li, long id) throws Exception;

    // 备件描述
    DataResult selectPartData(LoginInfo li, long id) throws Exception;

    DataResult updatePartData(LoginInfo li, long id, String partDesc, String fileCodes) throws Exception;

    // 备件设备
    DataResult selectPartEquipment(LoginInfo li, int pageNum, int pageSize, long id) throws Exception;

    DataResult insertPartEquipment(LoginInfo li, long id, String equipmentIds) throws Exception;

    DataResult deletePartEquipment(LoginInfo li, String ids) throws Exception;

    // 备件出入库记录
    DataResult selectPartInOutLog(LoginInfo li, int pageNum, int pageSize, long id) throws Exception;

    // 备件在途记录
    DataResult selectPartTransitLog(LoginInfo li, int pageNum, int pageSize, long id) throws Exception;

    // 备件库存
    DataResult selectPartStock(LoginInfo li, int pageNum, int pageSize, long id) throws Exception;

    DataResult insertPartStock(LoginInfo li, long id, long warehouse, long locator) throws Exception;

    DataResult deletePartStock(LoginInfo li, long id) throws Exception;

    // 备件附件
    DataResult selectPartDocument(LoginInfo li, int pageNum, int pageSize, long id) throws Exception;

    DataResult insertPartDocument(LoginInfo li, long id, String fileCodes) throws Exception;

    DataResult deletePartDocument(LoginInfo li, long id) throws Exception;

    // 备件入库
    DataResult selectStockInfo(LoginInfo li, long id) throws Exception;

    DataResult insertPartIn(LoginInfo li, int inType, String data) throws Exception;

    // 备件出库申请
    DataResult selectPartApply(LoginInfo li, int pageNum, int pageSize, String applyCode, String state, String minPartClass, String maxPartClass, String minPassTime, String maxPassTime) throws Exception;

    DataResult selectPartApplyOne(LoginInfo li, long id) throws Exception;

    DataResult insertPartApply(LoginInfo li, int outType, String applyDesc, String businessId, String businessCode, String data) throws Exception;

    DataResult updatePartApply(LoginInfo li, long id, int outType, String applyDesc, String data) throws Exception;

    DataResult updatePartApplyState(LoginInfo li, long id, int operation, String applyDesc) throws Exception;

    DataResult selectPartApplyLog(LoginInfo li, int pageNum, int pageSize, long id) throws Exception;

    // 备件出库审批
    DataResult selectPartReview(LoginInfo li, int pageNum, int pageSize, String applyCode, String state) throws Exception;

    // 出入库记录
    DataResult selectPartOrder(LoginInfo li, int pageNum, int pageSize, String orderCode, String operationEmployeeName, String businessCode, String orderType, String minOperationTime, String maxOperationTime, String inOutType, String state) throws Exception;

    DataResult selectPartOrderByUserId(LoginInfo li, int pageNum, int pageSize, String orderCode, String operationEmployeeName, String businessCode, String orderType, String minOperationTime, String maxOperationTime, String inOutType, String state) throws Exception;

    DataResult selectPartOrderOne(LoginInfo li, int orderType, long id) throws Exception;

    // 备件出库
    DataResult insertPartOut(LoginInfo li, long id, String data, String fileCodes) throws Exception;

    // 备件仓库库存
    DataResult selectPartWarehouseStock(LoginInfo li, int pageNum, int pageSize, String warehouse, String codeOrName) throws Exception;

    // 备件盘点
    DataResult selectPartInventory(LoginInfo li, int pageNum, int pageSize, String inventoryCode, String state, String result) throws Exception;

    DataResult selectPartInventoryOne(LoginInfo li, long id) throws Exception;

    DataResult insertPartInventory(LoginInfo li, long warehouse, String remark, String data) throws Exception;

    DataResult updatePartInventory(LoginInfo li, long id, long warehouse, String remark, String data) throws Exception;

    DataResult deletePartInventory(LoginInfo li, long id) throws Exception;

    DataResult updatePartInventoryStart(LoginInfo li, long id) throws Exception;

    DataResult updatePartInventoryData(LoginInfo li, long id, String data) throws Exception;

    DataResult updatePartInventoryEnd(LoginInfo li, long id) throws Exception;

    // 维保直接生成出库单返回出库单id
    // orderId：维保单id
    // orderCode：维保单号
    // partMap：备件id:出库备件数量
    // 返回0L时为库存不足
    long insertOrderOut(LoginInfo li, long orderId, String orderCode, Map<Long, Integer> partMap) throws Exception;

    // 维修出库的备件
    DataResult selectPartOrderOneByRepair(LoginInfo li, long id) throws Exception;


    Map<Long, PartInfo> getPartMapByPartIdList(List<Long> partIdList);


    List<PartApplyDetail> getPartApplyDetailByApplyId(Long applyId);


}
